<?
namespace xto\data\service;

use xto\App;
use xto\data\Sql;
use xto\data\model\PayModel;

class PayService{
	static function create($data){
		$map=[
			'appid'=>App::appid(),
			'paytype'=>$data['paytype']
		];
		return Sql::saveorupdate('xto_pays',$data,$map);
	}

	static function getPay($type){
		$map=[
			'appid'=>App::appid(),
			'paytype'=>$type
		];
		return Sql::find('xto_pays',$map); 
	}

	static function selectAll($pagezie){
		$result=array();
		$p=new PayModel();
		$list = $p->order('payid', 'asc')->paginate($pagezie);
		$page = $list->render();
		$result['list']=$list;
		$result['page']=$page;
		return $result;
	}
}